{include="header"}

<script type="text/javascript">
   function delete_serie(cod)
   {
      if( confirm("¿Realmente desea eliminar la serie "+cod+"?") )
         window.location.href = '{$fsc->url()}&delete='+cod;
   }
</script>

<div class="table-responsive">
   <table class="table table-hover">
      <thead>
         <tr>
            <th class="text-left">Código</th>
            <th class="text-left">Descripción</th>
            <th class="text-center">Sin IVA</th>
            <th class="text-right">IRPF</th>
            <th class="text-right">Acciones</th>
         </tr>
      </thead>
      {loop="$fsc->serie->all()"}
      <form action ="{$fsc->url()}" method="post">
         <input type="hidden" name="codserie" value="{$value->codserie}"/>
         <tr>
            <td><div class="form-control">{$value->codserie}</div></td>
            <td><input class="form-control" type="text" name="descripcion" value="{$value->descripcion}" autocomplete="off"/></td>
            <td class="text-center">
               <input type="checkbox" name="siniva" value="TRUE"{if condition="$value->siniva"} checked="checked"{/if}/>
            </td>
            <td><input class="form-control text-right" type="text" name="irpf" value="{$value->irpf}" autocomplete="off"/></td>
            <td class="text-right">
               <div class="btn-group">
                  <a class="btn btn-sm btn-danger" title="Eliminar" onclick="delete_serie('{$value->codserie}')">
                     <span class="glyphicon glyphicon-trash"></span>
                  </a>
                  <button class="btn btn-sm btn-primary" type="submit" title="Guardar" onclick="this.disabled=true;this.form.submit();">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </div>
            </td>
         </tr>
      </form>
      {/loop}
      <form class="form" name="f_nueva_serie" action ="{$fsc->url()}" method="post">
         <tr class="bg-info">
            <td><input class="form-control" type="text" name="codserie" placeholder="Nuevo código..." autocomplete="off"/></td>
            <td><input class="form-control" type="text" name="descripcion" autocomplete="off"/></td>
            <td class="text-center">
               <input type="checkbox" name="siniva" value="TRUE"/>
            </td>
            <td><input class="form-control text-right" type="text" name="irpf" value="0" autocomplete="off"/></td>
            <td class="text-right">
               <button class="btn btn-sm btn-primary" type="submit" title="Guardar" onclick="this.disabled=true;this.form.submit();">
                  <span class="glyphicon glyphicon-floppy-disk"></span>
               </button>
            </td>
         </tr>
      </form>
   </table>
</div>

{include="footer"}